package cn.stylefeng.guns.sys.modular.system.service.impl;

import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.core.util.DateUtil;
import cn.stylefeng.guns.sys.modular.system.entity.BtyBank;
import cn.stylefeng.guns.sys.modular.system.mapper.BtyBankMapper;
import cn.stylefeng.guns.sys.modular.system.model.params.BtyBankParam;
import cn.stylefeng.guns.sys.modular.system.model.params.YybbParam;
import cn.stylefeng.guns.sys.modular.system.model.result.BtyBankResult;
import cn.stylefeng.guns.sys.modular.system.model.result.YybbResult;
import  cn.stylefeng.guns.sys.modular.system.service.BtyBankService;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import cn.stylefeng.roses.core.util.ToolUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.io.Serializable;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author liuy
 * @since 2021-09-28
 */
@Service
public class BtyBankServiceImpl extends ServiceImpl<BtyBankMapper, BtyBank> implements BtyBankService {

    @Override
    public void add(BtyBankParam param){
        BtyBank entity = getEntity(param);
        this.save(entity);
    }

    @Override
    public void delete(BtyBankParam param){
        this.removeById(getKey(param));
    }

    @Override
    public void update(BtyBankParam param){
        BtyBank oldEntity = getOldEntity(param);
        BtyBank newEntity = getEntity(param);
        ToolUtil.copyProperties(newEntity, oldEntity);
        this.updateById(newEntity);
    }

    @Override
    public BtyBankResult findBySpec(BtyBankParam param){
        return null;
    }

    @Override
    public List<BtyBankResult> findListBySpec(BtyBankParam param){
        return null;
    }

    @Override
    public LayuiPageInfo findPageBySpec(BtyBankParam param){
        //拼接查询条件
        String beginTime = "";
        String endTime = "";
        if (ToolUtil.isNotEmpty(param.getTimeLimit())) {
            String[] split = param.getTimeLimit().split(" - ");
            beginTime = split[0].replace("-","");
            endTime = split[1].replace("-","");;
            param.setBeginTime(beginTime);
            param.setEndTime(endTime);
        }
        Page pageContext = getPageContext();
        IPage page = this.baseMapper.customPageList(pageContext, param);
        return LayuiPageFactory.createPageInfo(page);
    }

    @Override
    public List<BtyBankResult> dmList(BtyBankParam param) {
        return baseMapper.dmList(param);
    }

    @Override
    public ResponseData confirmOk(BtyBankParam param) throws ParseException {
//        String beginTime = "";
//        String endTime = "";
//        String firstDay="";
//        String lastDay="";
//        if (ToolUtil.isNotEmpty(param.getTimeLimit())) {
//            String[] split = param.getTimeLimit().split(" - ");
//            beginTime = split[0].replace("-","");
//            endTime = split[1].replace("-","");
//            //获取beginTime所在月的第一天和最后一天
//            firstDay=DateUtil.getMonthFirstDay(beginTime);
//            lastDay=DateUtil.getMonthLastDay(beginTime);
//            param.setBeginTime(beginTime);
//            param.setEndTime(endTime);
//            param.setFirstDay(firstDay);
//            param.setLastDay(lastDay);
//        }
//        BtyBankResult  results=baseMapper.getSxfByDm(param);
//        List<BtyBankResult>list=baseMapper.bankListByDm(param);
//
//        BigDecimal zfbsxf=BigDecimal.ZERO;
//        BigDecimal wxsxf=BigDecimal.ZERO;
//        BigDecimal mdsxf=BigDecimal.ZERO;
//        BigDecimal mtsxf=BigDecimal.ZERO;
//        //获取单店的支付宝手续费，微信手续费，买单手续费，美团手续费
//        if(ToolUtil.isNotEmpty(results)){
//            zfbsxf=results.getZfbsxf();
//            wxsxf=results.getWxsxf();
//            mdsxf=results.getMdsxf();
//            mtsxf=results.getMtsxf();
//        }
//        //美团团购
//        BigDecimal mttg=BigDecimal.ZERO;
//        //美团买单
//        BigDecimal mtmd=BigDecimal.ZERO;
//        //微信
//        BigDecimal wx=BigDecimal.ZERO;
//        //会员卡
//        BigDecimal hyk=BigDecimal.ZERO;
//        //现金
//        BigDecimal xj=BigDecimal.ZERO;
//        //支付宝
//        BigDecimal zfb=BigDecimal.ZERO;
//        //美团外卖
//        BigDecimal mtwm=BigDecimal.ZERO;
//        for (BtyBankResult yybbResult : list) {
//            String zy=yybbResult.getZy()==null?"":yybbResult.getZy();
//            if(zy.contains("美团团购")){
//                mttg=mttg.add(yybbResult.getSr());
//            } else if(zy.contains("美团买单")){
//                mtmd=mtmd.add(yybbResult.getSr());
//            }else if(zy.contains("微信分")){
//                wx=wx.add(yybbResult.getSr());
//            }else if(zy.contains("会员分")){
//                hyk=hyk.add(yybbResult.getSr());
//            }else if(zy.contains("xj")){
//                xj=xj.add(yybbResult.getSr());
//            }else if(zy.contains("宝宝分")){
//                zfb=zfb.add(yybbResult.getSr());
//            }else if(zy.contains("美团外卖")){
//                mtwm=mtwm.add(yybbResult.getSr());
//            }
//        }
//
//        int mttgFlag=mttg.compareTo(BigDecimal.ZERO);
//        int mtmdFlag=mtmd.compareTo(BigDecimal.ZERO);
//        int wxFlag=wx.compareTo(BigDecimal.ZERO);
//        int hykFlag=hyk.compareTo(BigDecimal.ZERO);
//        int xjFlag=xj.compareTo(BigDecimal.ZERO);
//        int zfbFlag=zfb.compareTo(BigDecimal.ZERO);
//        int mtwmFlag=mtwm.compareTo(BigDecimal.ZERO);
//        RestTemplate restTemplate = new RestTemplate();
//        HttpHeaders headers = new HttpHeaders();
//        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
//        headers.setContentType(type);
//        headers.add("trantype", "code"); // 档案翻译方式，枚举值为：编码请录入 code， 名称请录入 name， 主键请录入 pk
//        headers.add("system", "001"); // 系统编码
//        headers.add("usercode", "15253172037"); // 用户
//        headers.add("password", "514576f58a89767b46c1b44767a08f77");
//        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
//        BigDecimal mtDf=mtsxf.add(mttg);
//        BigDecimal mdDf=mdsxf.add(mtmd);
//        BigDecimal wxDf=wxsxf.add(wx);
//        BigDecimal zfbDf=zfbsxf.add(zfb);
//        StringBuilder sb=new StringBuilder();
//        sb.append("{\n" +
//                "    \"voucher\":[\n" +
//                "        {\n" +
//                "            \"details\":[");
//        //美团团购金额大于0的话，生成美团团购的凭证
//        if(mttgFlag==1){
//            sb.append("                {\n" +
//                    "                    \"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":\"\",\n" +
//                    "                    \"debitamount\":"+mtsxf+",\n" +
//                    "                    \"explanation\":\"美团服务费\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"660120\",\n" +
//                    "                    \"pk_currtype\":\"CNY\"\n" +
//                    "                }," +
//                    "{\n" +
//                    "                    \"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"96\",\n" +
//                    "                            \"checkvaluecode\":"+yhk+"\n" +
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":\"\",\n" +
//                    "                    \"debitamount\":"+mttg+",\n" +
//                    "                    \"explanation\":\"收美团\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"100202\",\n" +
//                    "                    \"pk_currtype\":\"CNY\"\n" +
//                    "                },"+
//                    "{\n" +
//                    "\t\t\t\t\"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "\t\t\t\t\t\t{\n" +
//                    "                            \"checktypecode\":\"7\",\n" +
//                    "                            \"checkvaluecode\":\"0031\"\n" + //美团团购编号
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":"+mtDf+",\n" +
//                    "                    \"creditquantity\":\"\",\n" +
//                    "                    \"debitamount\":\"\",\n" +
//                    "                    \"debitquantity\":\"\",\n" +
//                    "                    \"detailindex\":\"\",\n" +
//                    "                    \"excrate1\":\"\",\n" +
//                    "                    \"explanation\":\"收美团\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"112205\",\n" +
//                    "                    \"pk_currtype\":\"CNY\",\n" +
//                    "                    \"price\":\"\"\n" +
//                    "                },\n" );
//        }
//        //美团买单金额大于0的话，生成美团买单的凭证
//        if(mtmdFlag==1){
//            sb.append("                {\n" +
//                    "                    \"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":\"\",\n" +
//                    "                    \"debitamount\":"+mdsxf+",\n" +
//                    "                    \"explanation\":\"买单手续费\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"660301\",\n" +
//                    "                    \"pk_currtype\":\"CNY\"\n" +
//                    "                }," +
//                    "{\n" +
//                    "                    \"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"96\",\n" +
//                    "                            \"checkvaluecode\":"+yhk+"\n" +
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":\"\",\n" +
//                    "                    \"debitamount\":"+mtmd+",\n" +
//                    "                    \"explanation\":\"收买单\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"100202\",\n" +
//                    "                    \"pk_currtype\":\"CNY\"\n" +
//                    "                },"+
//                    "{\n" +
//                    "\t\t\t\t\"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "\t\t\t\t\t\t{\n" +
//                    "                            \"checktypecode\":\"7\",\n" +
//                    "                            \"checkvaluecode\":\"0015\"\n" + //点评买单编号
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":"+mdDf+",\n" +
//                    "                    \"creditquantity\":\"\",\n" +
//                    "                    \"debitamount\":\"\",\n" +
//                    "                    \"debitquantity\":\"\",\n" +
//                    "                    \"detailindex\":\"\",\n" +
//                    "                    \"excrate1\":\"\",\n" +
//                    "                    \"explanation\":\"收买单\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"112208\",\n" +
//                    "                    \"pk_currtype\":\"CNY\",\n" +
//                    "                    \"price\":\"\"\n" +
//                    "                },\n");
//        }
//        if(wxFlag==1){
//            sb.append("                {\n" +
//                    "                    \"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":\"\",\n" +
//                    "                    \"debitamount\":"+wxsxf+",\n" +
//                    "                    \"explanation\":\"微信手续费\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"660301\",\n" +
//                    "                    \"pk_currtype\":\"CNY\"\n" +
//                    "                }," +
//                    "{\n" +
//                    "                    \"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"96\",\n" +
//                    "                            \"checkvaluecode\":"+yhk+"\n" +
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":\"\",\n" +
//                    "                    \"debitamount\":"+wx+",\n" +
//                    "                    \"explanation\":\"收微信\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"100202\",\n" +
//                    "                    \"pk_currtype\":\"CNY\"\n" +
//                    "                },"+
//                    "{\n" +
//                    "\t\t\t\t\"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "\t\t\t\t\t\t{\n" +
//                    "                            \"checktypecode\":\"7\",\n" +
//                    "                            \"checkvaluecode\":\"0172\"\n" + //微信收款编号
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":"+wxDf+",\n" +
//                    "                    \"creditquantity\":\"\",\n" +
//                    "                    \"debitamount\":\"\",\n" +
//                    "                    \"debitquantity\":\"\",\n" +
//                    "                    \"detailindex\":\"\",\n" +
//                    "                    \"excrate1\":\"\",\n" +
//                    "                    \"explanation\":\"收微信\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"112206\",\n" +
//                    "                    \"pk_currtype\":\"CNY\",\n" +
//                    "                    \"price\":\"\"\n" +
//                    "                },\n");
//        }
//        if(hykFlag==1){
//            sb.append("                {\n" +
//                    "                    \"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"96\",\n" +
//                    "                            \"checkvaluecode\":"+yhk+"\n" +
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":\"\",\n" +
//                    "                    \"debitamount\":"+hyk+",\n" +
//                    "                    \"explanation\":\"收会员卡\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"100202\",\n" +
//                    "                    \"pk_currtype\":\"CNY\"\n" +
//                    "                }," +
//                    "{\n" +
//                    "\t\t\t\t\"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "\t\t\t\t\t\t{\n" +
//                    "                            \"checktypecode\":\"7\",\n" +
//                    "                            \"checkvaluecode\":\"0022\"\n" + //会员卡储值编号
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":"+hyk+",\n" +
//                    "                    \"creditquantity\":\"\",\n" +
//                    "                    \"debitamount\":\"\",\n" +
//                    "                    \"debitquantity\":\"\",\n" +
//                    "                    \"detailindex\":\"\",\n" +
//                    "                    \"excrate1\":\"\",\n" +
//                    "                    \"explanation\":\"收会员卡\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"112210\",\n" +
//                    "                    \"pk_currtype\":\"CNY\",\n" +
//                    "                    \"price\":\"\"\n" +
//                    "                },\n");
//        }
//        if(xjFlag==1){
//            sb.append("                {\n" +
//                    "                    \"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"96\",\n" +
//                    "                            \"checkvaluecode\":"+yhk+"\n" +
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":\"\",\n" +
//                    "                    \"debitamount\":"+xj+",\n" +
//                    "                    \"explanation\":\"收现金\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"100202\",\n" +
//                    "                    \"pk_currtype\":\"CNY\"\n" +
//                    "                }," +
//                    "{\n" +
//                    "\t\t\t\t\"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "\t\t\t\t\t\t{\n" +
//                    "                            \"checktypecode\":\"7\",\n" +
//                    "                            \"checkvaluecode\":\"0038\"\n" + //人民币编号
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":"+xj+",\n" +
//                    "                    \"creditquantity\":\"\",\n" +
//                    "                    \"debitamount\":\"\",\n" +
//                    "                    \"debitquantity\":\"\",\n" +
//                    "                    \"detailindex\":\"\",\n" +
//                    "                    \"excrate1\":\"\",\n" +
//                    "                    \"explanation\":\"收现金\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"112203\",\n" +
//                    "                    \"pk_currtype\":\"CNY\",\n" +
//                    "                    \"price\":\"\"\n" +
//                    "                },\n");
//        }
//        if(zfbFlag==1){
//            sb.append("                {\n" +
//                    "                    \"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        }\n" +
//                    "                    ],\n" +
//
//                    "                    \"creditamount\":\"\",\n" +
//                    "                    \"debitamount\":"+zfbsxf+",\n" +
//                    "                    \"explanation\":\"支付宝手续费\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"660301\",\n" +
//                    "                    \"pk_currtype\":\"CNY\"\n" +
//                    "                }," +
//                    "{\n" +
//                    "                    \"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"96\",\n" +
//                    "                            \"checkvaluecode\":"+yhk+"\n" +
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":\"\",\n" +
//                    "                    \"debitamount\":"+zfb+",\n" +
//                    "                    \"explanation\":\"收支付宝\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"100202\",\n" +
//                    "                    \"pk_currtype\":\"CNY\"\n" +
//                    "                },"+
//                    "{\n" +
//                    "\t\t\t\t\"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "\t\t\t\t\t\t{\n" +
//                    "                            \"checktypecode\":\"7\",\n" +
//                    "                            \"checkvaluecode\":\"0189\"\n" + //支付宝收款编号
//                    "                        }\n" +
//                    "                    ],\n" +
//                    "                    \"creditamount\":"+zfbDf+",\n" +
//                    "                    \"creditquantity\":\"\",\n" +
//                    "                    \"debitamount\":\"\",\n" +
//                    "                    \"debitquantity\":\"\",\n" +
//                    "                    \"detailindex\":\"\",\n" +
//                    "                    \"excrate1\":\"\",\n" +
//                    "                    \"explanation\":\"收支付宝\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"112207\",\n" +
//                    "                    \"pk_currtype\":\"CNY\",\n" +
//                    "                    \"price\":\"\"\n" +
//                    "                },\n");
//        }
//        if(mtwmFlag==1){
//            sb.append("                {\n" +
//                    "                    \"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"96\",\n" +
//                    "                            \"checkvaluecode\":"+yhk+"\n" +
//                    "                        }\n" +
//                    "                    ],\n" +
//                    //借方科目
//                    "                    \"creditamount\":\"\",\n" +
//                    "                    \"debitamount\":"+mtwm+",\n" +
//                    "                    \"explanation\":\"收美团外卖\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"100202\",\n" +
//                    "                    \"pk_currtype\":\"CNY\"\n" +
//                    "                }," +
//                    "{\n" +
//                    //贷方辅助核算
//                    "\t\t\t\t\"ass\":[\n" +
//                    "                        {\n" +
//                    "                            \"checktypecode\":\"2\",\n" +
//                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
//                    "                        },\n" +
//                    "\t\t\t\t\t\t{\n" +
//                    "                            \"checktypecode\":\"7\",\n" +
//                    "                            \"checkvaluecode\":\"0035\"\n" + //美团外卖编号
//                    "                        }\n" +
//                    "                    ],\n" +
//                    //贷方科目
//                    "                    \"creditamount\":"+mtwm+",\n" +
//                    "                    \"creditquantity\":\"\",\n" +
//                    "                    \"debitamount\":\"\",\n" +
//                    "                    \"debitquantity\":\"\",\n" +
//                    "                    \"detailindex\":\"\",\n" +
//                    "                    \"excrate1\":\"\",\n" +
//                    "                    \"explanation\":\"收美团外卖\",\n" +
//                    "                    \"localcreditamount\":\"\",\n" +
//                    "                    \"localdebitamount\":\"\",\n" +
//                    "                    \"pk_accsubj\":\"112211\",\n" +
//                    "                    \"pk_currtype\":\"CNY\",\n" +
//                    "                    \"price\":\"\"\n" +
//                    "                }\n");
//        }
//        sb.append("            ],\n" +
//                "            \"pk_corp\":\"303\",\n" +
//                "            \"pk_glorgbook\":\"303-bty01\",\n" +
//                "            \"pk_prepared\":\"15253172037\",\n" +
//                "            \"pk_vouchertype\":\"记账\"\n" +
//                "        }\n" +
//                "    ]\n" +
//                "}");
//
//        HttpEntity<String> formEntity = new HttpEntity<String>(sb.toString(), headers);
//        String url = "http://124.70.28.147:8088/u8cloud/api/gl/voucher/insert";
//        String result = restTemplate.postForEntity(url, formEntity, String.class).getBody();
//        System.out.println("result:"+result);
//        JsonParser jp = new JsonParser();
//        //将json字符串转化成json对象
//        JsonObject jo = jp.parse(result).getAsJsonObject();
//        //获取errcode对应的值
//        String status = jo.get("status").getAsString();
//        String errormsg = jo.get("errormsg").getAsString();
//        if(status.equals("falied")){
//            return  ResponseData.error(501,errormsg);
//        }else{
//            return ResponseData.success();
//        }
        return ResponseData.success();
    }


    private Serializable getKey(BtyBankParam param){
        return null;
    }

    private Page getPageContext() {
        return LayuiPageFactory.defaultPage();
    }

    private BtyBank getOldEntity(BtyBankParam param) {
        return this.getById(getKey(param));
    }

    private BtyBank getEntity(BtyBankParam param) {
        BtyBank entity = new BtyBank();
        ToolUtil.copyProperties(param, entity);
        return entity;
    }

}
